UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ncEnUN2dbPdDvDUtfGXLoh303sqyOfTSQ6ALp2pPsOk=' 
WHERE 
  key_id = '484882992d4d4e2afff4017eeee5ffbca441dc5362f0a6edc017b55b3657ece6' 
  AND (
    token = 'ncEnUN2dbPdDvDUtfGXLoh303sqyOfTSQ6ALp2pPsOk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032