UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wGut2uTPUzv6ySZqBk4LM7sT6Fkz9ddQlt4fAmBHFaY=' 
WHERE 
  key_id = 'c52d3426222945676d3e1f006f435223c2c93fb25debeb4e3c22347263668d63' 
  AND (
    token = 'wGut2uTPUzv6ySZqBk4LM7sT6Fkz9ddQlt4fAmBHFaY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043