UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jWYg1G+hbg4d3CWzYKP8ysicMgpDfvPfzGsUIkFUgpQ=' 
WHERE 
  key_id = '9f43287705f288c2ac91970a41f8e69fe27c1aa76d7f8b3cc9e67901bc5d9986' 
  AND (
    token = 'jWYg1G+hbg4d3CWzYKP8ysicMgpDfvPfzGsUIkFUgpQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030