UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EL6QXeeBdrtjtfimDWccSUA/m63gSVGNXS/0USaahN8=' 
WHERE 
  key_id = '5c1f26413bb96858f21c5ac7e6b33afbb373ab869bee37f351ba084cf880150a' 
  AND (
    token = 'EL6QXeeBdrtjtfimDWccSUA/m63gSVGNXS/0USaahN8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034