UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PbPXC5Z9PLwJpforu1IkgDqS3uRjfp9fqf+YurhdmZo=' 
WHERE 
  key_id = '5f8e25cf9c8fab17c041daa100255941161f47ad3771e3092d809e39bd53370c' 
  AND (
    token = 'PbPXC5Z9PLwJpforu1IkgDqS3uRjfp9fqf+YurhdmZo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016