UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hyb83Oqb9m1CJWWgboXuV3FOwuEbQHSFdvp4Jm/ngvU=' 
WHERE 
  key_id = 'ddffae02e2a3c88461f784d0922bb88ec84da5444dc62f193d1f55bf0cea985e' 
  AND (
    token = 'Hyb83Oqb9m1CJWWgboXuV3FOwuEbQHSFdvp4Jm/ngvU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031