UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '01J2q26shuxaQzrAP9xUBgMjla+HelFmz4lf1tgAPQ0=' 
WHERE 
  key_id = 'd712d37640c528dc54848602d66eba64e3e280d4b3c0a468fdcef52f3bb3d9b7' 
  AND (
    token = '01J2q26shuxaQzrAP9xUBgMjla+HelFmz4lf1tgAPQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021