UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'meo17eR21CLfPTing91Il2i3NOyWDVLZ7lpnX+JMdCw=' 
WHERE 
  key_id = '62c5579e02f35c4bef590efef650f6edb353a575a78f9757405693f98651a783' 
  AND (
    token = 'meo17eR21CLfPTing91Il2i3NOyWDVLZ7lpnX+JMdCw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045