UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IT5T1lH3pSzCBTcClaMLHA3/YXXuvA4m3pQCJb8Tn8c=' 
WHERE 
  key_id = 'e2209457ec0a396c4dfc4ff104297319d8ae877f789241cb2788b6bcebd0a515' 
  AND (
    token = 'IT5T1lH3pSzCBTcClaMLHA3/YXXuvA4m3pQCJb8Tn8c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035