UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xfgQRoV99MoC9bj0Ix5I2mIE+yMEyqQbNqFOmaqH4Kw=' 
WHERE 
  key_id = '4a2a17f7b49818be9a32a2041729c9a7e2708053a2ad1ab3437763bd5e8380aa' 
  AND (
    token = 'xfgQRoV99MoC9bj0Ix5I2mIE+yMEyqQbNqFOmaqH4Kw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038