UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BMIr+l62MGl1bB+r2zY6ugPiHlq5c6M1euSRXtUfzKs=' 
WHERE 
  key_id = '941510f363ed41768474d4424ec14535d141cf60643cd54b276726b044767237' 
  AND (
    token = 'BMIr+l62MGl1bB+r2zY6ugPiHlq5c6M1euSRXtUfzKs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033