UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cRERLtmhjMMB+XEXazRBN2AbjFN2ldhN24NGtutkU2M=' 
WHERE 
  key_id = 'e41b5cf4a57f66bb80dadbcce8241501a8ef15be2dbbc08666936a1b839e91d3' 
  AND (
    token = 'cRERLtmhjMMB+XEXazRBN2AbjFN2ldhN24NGtutkU2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034