UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gcWh3EsY/AC+UWykapR7+UBHmOMITxw0NLxQF1FzOPM=' 
WHERE 
  key_id = '33c518fdd4c99664917d1c260e0db39a281369cd4b22852c394688ea7f090051' 
  AND (
    token = 'gcWh3EsY/AC+UWykapR7+UBHmOMITxw0NLxQF1FzOPM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023