UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ek8yrE9dfGbM9Jm3S3Zxm95UUX0LyFZfudArQHrhmXA=' 
WHERE 
  key_id = '222fb6ed6f1fa1fd477adc0e18eab9a12a429c90e43deadbf77ddb3fed37a575' 
  AND (
    token = 'ek8yrE9dfGbM9Jm3S3Zxm95UUX0LyFZfudArQHrhmXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018