UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ot5KUawyilhkHfPVhJbptv8S3GW3ghvbjIcZ/qsPt1k=' 
WHERE 
  key_id = '7e0c93ef4038260e265f75e2e1ad622006c4e56733c7d480b4070febe9a76f74' 
  AND (
    token = 'Ot5KUawyilhkHfPVhJbptv8S3GW3ghvbjIcZ/qsPt1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023