UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'veTeDFaA8dFId7WgCw/QsIT3h7oBqHay7ePFP4mJIac=' 
WHERE 
  key_id = '4da573a5afb3b96acf6ea8dbfb885e14da9cca4b5b41608071406143267fe9cb' 
  AND (
    token = 'veTeDFaA8dFId7WgCw/QsIT3h7oBqHay7ePFP4mJIac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024