UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MyywTVnTg7NCmvnBKHn6maEPkZ7tBCaZhrSvyQqSMZw=' 
WHERE 
  key_id = '9cefabbc3e58b1c79a57a005f9c71926ee191cc5f6e68f11386656d899207813' 
  AND (
    token = 'MyywTVnTg7NCmvnBKHn6maEPkZ7tBCaZhrSvyQqSMZw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028