UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ys6129SMs5qTjaDV4DBKrACwacMxIEusTtnXGcW1s4Q=' 
WHERE 
  key_id = 'f47ff7381ec240e3ad821d54bc3cb527951a89f27c148a07bca824c1aebac70c' 
  AND (
    token = 'Ys6129SMs5qTjaDV4DBKrACwacMxIEusTtnXGcW1s4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042