UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lA7q+TSlbduXVE+qUB0jJ0x8subZ2t+a6Uj0/l2SZpU=' 
WHERE 
  key_id = '2a935e3d22713527d8d86ca660b37f05cddf0fa84302dd9d237a9362dd4c1686' 
  AND (
    token = 'lA7q+TSlbduXVE+qUB0jJ0x8subZ2t+a6Uj0/l2SZpU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018