UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't4Umj3oLv4jzZJRZMYsPQ+QGp5yxUkddCGCrg3nQxAM=' 
WHERE 
  key_id = '811c774fb76f05013d4a6465109d3cb4b0526eddb702a86d31422da83c71334d' 
  AND (
    token = 't4Umj3oLv4jzZJRZMYsPQ+QGp5yxUkddCGCrg3nQxAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027