UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4hsr6ELGxwSikS3x+3kqF2WKEQVGAwWxTXIZpE6KIuc=' 
WHERE 
  key_id = 'b733871c82318205937c3f2e51200f976437affa2fd3a232c53310f3774c682c' 
  AND (
    token = '4hsr6ELGxwSikS3x+3kqF2WKEQVGAwWxTXIZpE6KIuc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044