UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MuhN+d3cB94Ax4KJ5C7ADehwhTelTTdrG2bLSBfKJYE=' 
WHERE 
  key_id = '3e5eb78d4cae4f7f9ab9f70e0795ce7d5fe7c8fcafb41a83091e5be7a8b71983' 
  AND (
    token = 'MuhN+d3cB94Ax4KJ5C7ADehwhTelTTdrG2bLSBfKJYE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046