UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IjzMlTbKPMf4ieT+wdNj9tVpEnSNwqJ621dOsz9r3PQ=' 
WHERE 
  key_id = '841910f637a039410f6750597c5a066ffdc9557bba59f8335b8c5911e6f2f0e0' 
  AND (
    token = 'IjzMlTbKPMf4ieT+wdNj9tVpEnSNwqJ621dOsz9r3PQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035