UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TGoc06LnZz2bCWKdONE2tL7XTc8+UA/ZzL/Z7V1+VfY=' 
WHERE 
  key_id = '37f16bd5f77e080a123d451382b44ce63acaf73e2a46e3902f99fd3e655acfbc' 
  AND (
    token = 'TGoc06LnZz2bCWKdONE2tL7XTc8+UA/ZzL/Z7V1+VfY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032