UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IHE8KdLOG1GtWXplCeSH6kQ0/fikoxDQCc61dxnFkfc=' 
WHERE 
  key_id = 'cd5605d0503d4fe24d5f9698f517e91a63d3d6129f4ce4cc39ba1b36871bd15b' 
  AND (
    token = 'IHE8KdLOG1GtWXplCeSH6kQ0/fikoxDQCc61dxnFkfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030