UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CueiyiABHHf8YNSYD+4eyhu/qCDM2tH/MTtNRu9xcz4=' 
WHERE 
  key_id = '5a196769279dc33cbf7b749936d06a0f3f9480e66adf4a15230cfa91d84ab757' 
  AND (
    token = 'CueiyiABHHf8YNSYD+4eyhu/qCDM2tH/MTtNRu9xcz4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032