UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0H/fZCeZn17B5kCXb9wrWBSUBVnUCQxSYngxbjM+f64=' 
WHERE 
  key_id = '229ec9dfac4486581ad3e875e043f2c9c8d2b43852becb12345d5ae8fd369f29' 
  AND (
    token = '0H/fZCeZn17B5kCXb9wrWBSUBVnUCQxSYngxbjM+f64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023