UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W+AcLT/iIx2KP3M5eV8u08fQ2nQZZuMCX6d7vkLMjRc=' 
WHERE 
  key_id = '52f7b63cd2c1486d5fd97d16b2906a4b00303b4a7b5ea8c06879309e64202845' 
  AND (
    token = 'W+AcLT/iIx2KP3M5eV8u08fQ2nQZZuMCX6d7vkLMjRc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037