UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wn7Bo3h4QsYfsqBVFnOdTaWipEAS7ZFKLoFypQXh+d4=' 
WHERE 
  key_id = '031137110fc8a4c5b48fe45d6622b62f2e1ec8eec5e46a94a505bcb91becfda7' 
  AND (
    token = 'Wn7Bo3h4QsYfsqBVFnOdTaWipEAS7ZFKLoFypQXh+d4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045