UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EuZJ56tu+EB5X8h0fTvym4f/PeN8WmSuAghku/PXMUs=' 
WHERE 
  key_id = '781c2665962f1a1041f0f6c6e11196af0ef0c8870c89804a7e5c66bf7c10c36e' 
  AND (
    token = 'EuZJ56tu+EB5X8h0fTvym4f/PeN8WmSuAghku/PXMUs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048