UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3NS5o7dFjs/csgZE64LxASCPmSiNe7DfFzVJz1IbhSw=' 
WHERE 
  key_id = '5182fd2c46db4bf9fc95804cfe539617f67727b4d1a48f360e5cd82e905320de' 
  AND (
    token = '3NS5o7dFjs/csgZE64LxASCPmSiNe7DfFzVJz1IbhSw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037